Contents | Index | < Browse | Browse >

LETTERatan2ULETTER Returns the arctangent of x/y.

Overview
#include <math.h>

r = atan2(x, y);

double r; // result
double x; // angle
double y; // angle

Portability
ANSI

Description
atan2 computes the arctangent of x/y, that is, the angle j belonging to the "x = cos j" and "y = sin j" pair. The result is constrained as [-PI, +PI], and the function can be particularly useful to convert kartetic into polar coordinates.
This is so easy because The conversion from kartetic to polar coordinates is very easy because it allows you to compute the angle of the Radiale.

See also
atan , tan

Example
#include <stdio.h>
#include <math.h>

void main (void)
{
double result, x = 90.0, y = 15.0;
result = atan2(y, x);
printf("The arctangent of %lf is %lf\n",
(y/x), result);
}